from django import forms

from hot.forms.bootstrapform import BootStrapForm
from hot.utils import encry
from hot.models import Administrator


class ContentForm(BootStrapForm, forms.Form):
    no_widget_list = []
    """登录校验"""
    content_title = forms.CharField(
        max_length=255,
        required=False,
        widget=forms.TextInput,
        label='小标题',
    )
    content_detail = forms.CharField(widget=forms.Textarea, required=False)
    content_priority = forms.CharField(required=True)

    def clean_content_priority(self):
        content_priority = self.cleaned_data['content_priority']
        if content_priority == 'undefined':
            raise forms.ValidationError('栏目为空！')
        return content_priority
